home *** CD-ROM | disk | FTP | other *** search
- 2
- 40: 0c00 *= $0c00 ; starting address
- 50: 0c00 .opt p2
- ;
- ; this routine reads a hi-res picture from disk
- ; and stores it to memory at $2000 on the 128
- ; copyright (c) 1987 jake lund, sysop on cbmart forum, compuserve
- ; all rights reserved.
- ; source and object code uploaded to compuserve with permission
- ;
- 130: 0c00 status = 144 ; st is 0 if there's more in the file
- 140: 0c00 z1 = $fb ; free zero page location
- 150: 0c00 chkin = $ffc6 ; kernal routines
- 160: 0c00 chrin = $ffcf
- 170: 0c00 close = $ffc3
- 180: 0c00 clrchn = $ffcc
- 190: 0c00 hires = $2000 ; location of the bitmap
- ;
- 210: 0c00 a9 18 lda #24
- 210: 0c02 8d a9 0c sta lines ; rle pictures are only 192 pixels high (24*8)
- 220: 0c05 a2 01 ldx #1 ; logical file 1
- 230: 0c07 20 c6 ff jsr chkin ; for input
- ; lf 1 should have been opened before the sys
- ;
- 260: 0c0a a9 00 lda #<hires
- 260: 0c0c 85 fb sta z1
- 260: 0c0e a9 20 lda #>hires
- 260: 0c10 85 fc sta z1+1 ; z1 points to the screen
- 270: 0c12 a0 00 ldy #0
- ;
- 290: 0c14 20 a0 0c jsr setmask ; set the mask for $80
- 300: 0c17 18 clc
- 310: 0c18 bg = * ; bg checks for background bits
- 320: 0c18 08 php
- 320: 0c19 68 pla
- 320: 0c1a 8d aa 0c sta tempp ; store the processor status
- 330: 0c1d 20 67 0c bg1 jsr stat ; see if there's more in the file
- 340: 0c20 20 76 0c jsr gchar ; get a character
- 350: 0c23 f0 1c beq fg1 ; if zero, check for foreground
- 360: 0c25 90 46 bcc split ; if <32, we're done
- ;
- 380: 0c27 ad aa 0c lda tempp
- 380: 0c2a 48 pha
- 380: 0c2b 28 plp ; restore .p
- 390: 0c2c b0 08 bcs oop1
- 400: 0c2e 4e a8 0c bgloop lsr mask ; shift the mask right
- 410: 0c31 ca dex ; and count down
- 420: 0c32 f0 08 beq fg ; if x = 0, go to fg
- 430: 0c34 90 f8 bcc bgloop ; keep going if the carry hasn't appeared
- 440: 0c36 20 80 0c oop1 jsr plusy ; else move .y up by 8
- 450: 0c39 4c 2e 0c jmp bgloop
- ;
- 470: 0c3c fg = * ; handle the foreground pixels
- 480: 0c3c 08 php
- 480: 0c3d 68 pla
- 480: 0c3e 8d aa 0c sta tempp ; save .p
- 490: 0c41 20 67 0c fg1 jsr stat ; check the file status
- 500: 0c44 20 76 0c jsr gchar ; get a character
- 510: 0c47 f0 d4 beq bg1 ; if zero, back to the background
- 520: 0c49 90 22 bcc split ; if a ctrl-code, get out
- 530: 0c4b ad aa 0c lda tempp
- 530: 0c4e 48 pha
- 530: 0c4f 28 plp ; restore the carry flag
- 540: 0c50 b0 0f bcs oop2 ; if set, fix .y
- ;
- 560: 0c52 b1 fb fgloop lda (z1),y
- 560: 0c54 0d a8 0c ora mask
- 560: 0c57 91 fb sta (z1),y ; copy the bits from mask to screen
- 570: 0c59 4e a8 0c lsr mask
- 570: 0c5c ca dex
- 570: 0c5d f0 b9 beq bg ; keep shifting right, until .x is zero
- 580: 0c5f 90 f1 bcc fgloop ; keep looping
- 590: 0c61 20 80 0c oop2 jsr plusy ; until mask overflows
- 600: 0c64 4c 52 0c jmp fgloop ; but keep looping anyway
- ;
- ; subroutines here
- ;
- 640: 0c67 a5 90 stat lda status
- 640: 0c69 f0 0a beq contin ; this is like checking st in basic
- 650: 0c6b 68 quit pla
- 650: 0c6c 68 pla ; trash the return address and really quit
- 660: 0c6d a9 01 split lda #1
- 660: 0c6f 20 c3 ff jsr close
- 660: 0c72 20 cc ff jsr clrchn
- 670: 0c75 60 contin rts
- ;
- 690: 0c76 20 cf ff gchar jsr chrin ; get a character
- ; (in rle, codes are allowed to be from 32 to 127)
- 710: 0c79 29 7f and #127
- 710: 0c7b 38 sec
- 710: 0c7c e9 20 sbc #32 ; minus 32
- 720: 0c7e aa tax
- 720: 0c7f 60 rts
- ;
- 740: 0c80 98 plusy tya
- 740: 0c81 18 clc
- 740: 0c82 69 08 adc #8
- 740: 0c84 a8 tay ; add 8 to .y
- 750: 0c85 90 19 bcc setmask ; clear mask
- 760: 0c87 c8 plmore iny
- 760: 0c88 c0 08 cpy #8
- 760: 0c8a d0 14 bne setmask
- 770: 0c8c a0 00 ldy #0
- 770: 0c8e a9 40 lda #<320
- 770: 0c90 18 clc
- 770: 0c91 65 fb adc z1
- 770: 0c93 85 fb sta z1 ; add 320
- 780: 0c95 a9 01 lda #>320
- 780: 0c97 65 fc adc z1+1
- 780: 0c99 85 fc sta z1+1
- 790: 0c9b ce a9 0c dec lines
- 800: 0c9e f0 cb beq quit
- ;
- 820: 0ca0 a9 80 setmask lda #128
- 820: 0ca2 8d a8 0c sta mask
- 820: 0ca5 18 clc
- 820: 0ca6 60 rts ; this bit will eventually overflow
- ; after enough lsr's
- ;
- 850: 0ca7 60 rts
- 860: 0ca8 00 mask .byte0 ; variables
- 870: 0ca9 00 lines .byte0
- 880: 0caa 00 tempp .byte0
-